package com.wenwen.social.controller;

import cn.hutool.core.bean.BeanUtil;
import com.wenwen.social.application.dto.UserDTO;
import com.wenwen.social.domain.model.User;
import com.wenwen.social.domain.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.concurrent.ConcurrentHashMap;

@Service
public class BaseController {
	//临时使用
	private static UserDTO currentUser=new UserDTO();

	protected UserDTO getCurrLoginUser() {

		return currentUser;
	}

	@Autowired
	private UserService userService;

	protected void setCurrLoginUser(Long uid){
		if(uid == null){
			uid=3L;
		}
		User user = userService.getUser(uid);
		BeanUtil.copyProperties(user,currentUser);
	}
}
